home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Installation Tools & Overlays 2002 November
/
SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso
/
dist
/
cluster_admin.idb
/
etc
/
init.d
/
cluster.z
/
cluster
Wrap
Text File
|
2002-10-15
|
9KB
|
304 lines
#! /sbin/sh
#
# Copyright (C) 1998, Silicon Graphics, Inc.
# All Rights Reserved.
#
# UNPUBLISHED -- Rights reserved under the copyright laws of the United
# States. Use of a copyright notice is precautionary only and does not
# imply publication or disclosure.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
# SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
# DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
# PERMISSION OF SILICON GRAPHICS, INC.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
# Use, duplication or disclosure by the Government is subject to
# restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
# clause at DFARS 252.227-7013 and/or in similar or successor clauses
# in the FAR, or the DOD or NASA FAR Supplement. Unpublished-- rights
# reserved under the copyright laws of the United States.
# Contractor/manufacturer is Silicon Graphics, Inc.,
# 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
#
#
# Cluster Services control
#
# "$Id: cluster-init.d,v 1.30 2002/08/05 15:32:29 dxm.longdrop.melbourne.sgi.com Exp $"
BIN=/usr/cluster/bin
LBIN=/usr/lib32/cluster/cbe
if /etc/chkconfig verbose; then
ECHO=echo
else
ECHO=:
fi
SIGTERM_TMOUT=5;
# cmond command timeout: 30 seconds
CMON_TMOUT=30
CMON_START="/usr/cluster/bin/cmon_ctrl start -r -t ${CMON_TMOUT} -g"
CMON_STOP="/usr/cluster/bin/cmon_ctrl stop -r -f -t ${CMON_TMOUT} -g"
CMON_RESTART="/usr/cluster/bin/cmon_ctrl restart -r -f -t ${CMON_TMOUT} -g"
CMON_EXIT="/usr/cluster/bin/cmon_ctrl exit -r -t ${CMON_TMOUT} -f"
CLUSTER_CONTROL_GRP=cluster_control
CLUSTER_ADMIN_GRP=cluster_admin
CLUSTER_CX_GRP=cluster_cx
FS2D_CAPS='CAP_NETWORK_MGT,CAP_SCHED_MGT,CAP_PRIV_PORT+ip'
CMOND_CAPS='CAP_NETWORK_MGT,CAP_SYSINFO_MGT,CAP_PRIV_PORT,CAP_PROC_MGT+ip'
case $1 in
'start')
if /etc/chkconfig cluster; then
$ECHO "Cluster services:\c"
# Check for license
if /etc/chkconfig cxfs_cluster; then
if $BIN/cxfslicense; then
echo "CXFS not properly licensed for this host. Run"
echo "\t'$BIN/cxfslicense -d'"
echo "for detailed failure information. After fixing the"
echo "license, please run '/etc/init.d/cluster restart'."
# Not exiting so clconfd will try to start and
# place a similar error message in the SYSLOG
fi
fi
# Start fs2d explicitly, before any of its clients start.
/sbin/killall -0 fs2d > /dev/null 2>&1
if [ $? -ne 0 ]; then
/sbin/rm -f /var/cluster/cdb/cdb.db#/##dblock > /dev/null 2>&1
/sbin/suattr -C "$FS2D_CAPS" -c \
"$LBIN/fs2d /var/cluster/cdb/cdb.db \# | cat > /dev/null"
$ECHO " fs2d\c"
fi
/sbin/killall -0 cmond > /dev/null 2>&1
if [ $? -ne 0 ]; then
#
# CAD uses lots of file descriptors. Not all file
# descriptors are open at the same time.
#
limit descriptors 2500
/sbin/suattr -C "$CMOND_CAPS" -c \
"$BIN/cmond `cat /etc/config/cmond.options 2>/dev/null`"
$ECHO " cmond\c"
fi
# Wait for cmond to start, sleep for 1 second.
/sbin/sleep 1;
# Starting cluster admin group processes. We will attempt
# to start cad 5 times since cmond takes time to start
# accepting requests.
try_cnt=0
while true; do
try_cnt=`expr $try_cnt + 1`
${CMON_START} ${CLUSTER_ADMIN_GRP} > /dev/null 2>&1;
start_status=$?
if [ $try_cnt -ge 5 -o $start_status -eq 0 ]; then
break;
fi
/sbin/sleep 2;
done
if [ $start_status -ne 0 ]; then
echo "Cluster admin processes could not be started."
echo "Please run /etc/init.d/cluster restart."
exit 1;
else
$ECHO " cad\c"
fi
# Starting cluster control group processes
${CMON_START} ${CLUSTER_CONTROL_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster control processes could not be started."
echo "Please run /etc/init.d/cluster restart."
exit 1;
else
$ECHO " crsd\c"
fi
$ECHO "."
fi
if /etc/chkconfig cxfs_cluster; then
$ECHO "CXFS Cluster services:\c"
if /etc/chkconfig cluster; then
# Starting cluster CX group processes
${CMON_START} ${CLUSTER_CX_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster CX processes could not be started."
echo "Please run /etc/init.d/cluster restart."
exit 1;
else
$ECHO " clconfd\c"
fi
$ECHO "."
else
echo "CXFS cluster services can not run without the basic"
echo "cluster services."
echo "Please run /etc/chkconfig cluster on."
exit 1;
fi
fi
;;
'stop')
#
# If cmond is not running, send SIGTERM to all cluster processes.
#
/sbin/killall -0 cmond > /dev/null 2>&1
if [ $? -ne 0 ]; then
/sbin/killall -k ${SIGTERM_TMOUT} cmond;
/sbin/killall -k ${SIGTERM_TMOUT} cad crsd;
if /etc/chkconfig cxfs_cluster; then
/sbin/killall -k ${SIGTERM_TMOUT} clconfd;
fi
else
if /etc/chkconfig cxfs_cluster; then
# Stopping cluster CX group processes
${CMON_STOP} ${CLUSTER_CX_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster CX processes could not be stopped"
exit 1;
fi
fi
# Stopping cluster control group processes
${CMON_STOP} ${CLUSTER_CONTROL_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster control process could not be stopped"
exit 1;
fi
# Stopping cluster admin processes
${CMON_STOP} ${CLUSTER_ADMIN_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster admin process could not be stopped"
exit 1;
fi
# Stopping cmond process
${CMON_EXIT} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "cmond process could not be stopped"
exit 1;
fi
fi
# Kill fs2d in the end.
/sbin/killall -0 fs2d > /dev/null 2>&1
if [ $? -eq 0 ]; then
/sbin/killall -k {SIGTERM_TMOUT} fs2d;
fi
;;
'restart')
if /etc/chkconfig cluster; then
$ECHO "Restarting cluster services..."
# Check for license
if /etc/chkconfig cxfs_cluster; then
if $BIN/cxfslicense; then
echo "CXFS not properly licensed for this host. Run"
echo "\t'$BIN/cxfslicense -d'"
echo "for detailed failure information."
# Not exiting so clconfd will try to start and
# place a similar error message in the SYSLOG
fi
fi
# Start fs2d explicitly, before any of its clients start.
/sbin/killall -0 fs2d > /dev/null 2>&1
if [ $? -ne 0 ]; then
/sbin/rm -f /var/cluster/cdb/cdb.db#/##dblock > /dev/null 2>&1
/sbin/suattr -C "$FS2D_CAPS" -c \
"$LBIN/fs2d /var/cluster/cdb/cdb.db \# | cat > /dev/null"
fi
# Check if cmond is running
/sbin/killall -0 cmond > /dev/null 2>&1
if [ $? -ne 0 ]; then
#
# CAD uses lots of file descriptors. Not all file
# descriptors are open at the same time.
#
limit descriptors 2500
/sbin/suattr -C "$CMOND_CAPS" -c \
"$BIN/cmond `cat /etc/config/cmond.options 2>/dev/null`"
# Wait for cmond to start. sleep for 5 seconds.
/sbin/sleep 5;
# Starting cluster admin group processes
${CMON_START} ${CLUSTER_ADMIN_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster admin processes could not be restarted"
exit 1;
fi
# Starting cluster control group processes
${CMON_START} ${CLUSTER_CONTROL_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster control processes could not be restarted"
exit 1;
fi
if /etc/chkconfig cxfs_cluster; then
# Starting cluster CX group processes
${CMON_START} ${CLUSTER_CX_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster CX processes could not be restarted"
exit 1;
fi
fi
else
# Make cmond reread configuration
/sbin/killall -HUP cmond
# Restarting cluster admin group processes
${CMON_RESTART} ${CLUSTER_ADMIN_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster admin processes could not be restarted"
exit 1;
fi
# Restarting cluster control group processes
${CMON_RESTART} ${CLUSTER_CONTROL_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster control processes could not be restarted"
exit 1;
fi
if /etc/chkconfig cxfs_cluster; then
# Restarting cluster CX group processes
${CMON_RESTART} ${CLUSTER_CX_GRP} > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Cluster CX processes could not be restarted"
exit 1;
fi
fi
fi
else
echo "cluster services are not currently configured on"
exit 1;
fi
;;
*)
echo "usage: /etc/init.d/cluster {start|stop|restart}"
;;
esac